<div id="content_data">
 	<form action="./pages" method="post" class="clearfix" name="onepage" id="onepage">
        <input type="hidden" name="request" id="request" value="save" />
        <input type="hidden" name="node" id="node" value="<%=page.item.id%>" />
        <input type="hidden" name="language" id="language" value="<%=page.language%>" />
        <input type="hidden" name="kind" id="kind" value="Used in Add Content" />


        <section>
            <div>
                <label for="title"><%= __('Page Title')%></label>
                <input name="title" id="title" type="text" value="<%= page.title %>" size="62" />
                <button id="doView"><%= __('View Page')%></button>
            </div>
        </section>
    
        <div id="tabs">
            <ul>
                <li><a href="#content"><%= __('Content')%></a></li>
                <li><a href="#seo"><%= __('SEO')%></a></li>
                <li><a href="#options"><%= __('Options')%></a></li>
            </ul>

            <!-- --------- -->
            <div id="content">
            <!-- --------- -->
                <div>
                    <h4><%= __('Intro')%></h4>
                    <% var prev = "X";
                         for (var ic in page.content) { var c = page.content[ic];
                            if ((prev != c.intro) && (c.intro == "N")) { prev = c.intro; %>
                    <h4 class="main"><%= __('Main')%></h4>
                            <% } %>
                    <article id="id_<%= c.id %>">
                    <input type="hidden" name="kind_<%= c.id %>" class="kind" value="<%= c.kind %>" />
                    <input type="hidden" name="sortorder_<%= c.id %>" class="sortorder" value="<%= c.sortorder %>" />
                    <input type="hidden" name="intro_<%= c.id %>" class="intro" value="<%= c.intro %>" />

                    <% if (c.kind == "T") { %>
                      <img src="<%=cstatic%>/icons/T.png">
                      <div class="inputE">
                        <input type="hidden" name="atom_<%= c.id %>" class="atom" value="<%= c.atomId %>" />
                        <input type="hidden" name="data_<%= c.id %>" class="textdata" value="<%= c.data %>" />
                        <h5><%= c.name %></h5>
                        <p id="data_<%= c.id %>"></p>
                      </div>
                      <div class="actions">
                        <button class="doEditorT"><%= __('Edit')%></button>
                        <button class="doDeletor"><%= __('Delete')%></button>
                        <span class="label label-info"><%= __('Move')%></span>
                      </div>

                    <% } else if (c.kind == "M") { %>
                      <img src="<%=cstatic%>/icons/M.png">
                      <div class="input">
                        <select name="atom_<%= c.id %>"><option value="0">-</option>
                          <%- cody.FormController.menuList( app.atoms, c.atom ) %>
                        </select>
                      </div>
                      <div class="actions">
                        <button class="doDeletor"><%= __('Delete')%></button>
                        <span class="label label-info"><%= __('Move')%></span>
                      </div>

                    <% } else if (c.kind == "S") { %>
                    <img src="<%=cstatic%>/icons/S.png">
                    <div class="input">
                      <input type="hidden" name="atom_<%= c.id %>" class="atom" value="<%= c.atomId %>" />
                      <h5><%= c.name %></h5>
                      <textarea name="data_<%= c.id %>" class="stringdata"><%= c.data %></textarea>
                    </div>
                    <div class="actions">
                      <button class="doDeletor"><%= __('Delete')%></button>
                      <span class="label label-info"><%= __('Move')%></span>
                    </div>

                    <% } else if (c.kind == "IC") { %>
                    <img src="<%=cstatic%>/icons/IC.png">
                    <div class="input">
                      <input type="hidden" name="atom_<%= c.id %>" class="atom" value="<%= c.atomId %>" />
                      <h5>Facebook 'like' - URL <small>(empty = current)</small></h5>
                      <textarea name="data_<%= c.id %>" class="stringdata"><%= c.data %></textarea>
                    </div>
                    <div class="actions">
                      <button class="doDeletor"><%= __('Delete')%></button>
                      <span class="label label-info"><%= __('Move')%></span>
                    </div>

                    <% } else if (c.kind == "H") { %>
                    <img src="<%=cstatic%>/icons/H.png">
                    <div class="input">
                      <input type="hidden" name="atom_<%= c.id %>" class="atom" value="<%= c.atomId %>" />
                      <h5>Facebook 'share' - URL <small>(empty = current)</small></h5>
                      <textarea name="data_<%= c.id %>" class="stringdata"><%= c.data %></textarea>
                    </div>
                    <div class="actions">
                      <button class="doDeletor">Delete</button>
                      <span class="label label-info"><%= __('Move')%></span>
                    </div>

                    <% } else if (c.kind == "F") { %>
                      <img src="<%=cstatic%>/icons/F.png">
                      <div class="inputE">
                        <input type="hidden" name="atom_<%= c.id %>" class="atom" value="<%= c.atomId %>" />
                        <% if ((typeof c.atom != "undefined") && (c.atomId != 0)) { %>
                          <% if ((c.atom.extention !== "") && (c.atom.extention !== "xxx")) { %>
                            <img class="icon" src="<%=cstatic%>/extentions/<%=c.atom.extention%>.png" />
                            <span><%= c.atom.name %>.<%= c.atom.extention %></span>
                          <% } else { %>
                            <img class="icon" src="<%=cstatic%>/extentions/file.png" />
                            <span><%= c.atom.name %></span>
                          <% } %>
                        <% } else { %>
                         <span>- none -</span>
                        <% } %>
                      </div>
                      <div class="actions">
                        <button class="doEditorF"><%= __('Edit')%></button>
                        <button class="doDeletor"><%= __('Delete')%></button>
                        <span class="label label-info"><%= __('Move')%></span>
                      </div>

                    <% } else if (c.kind == "I") { %>
                      <img src="<%=cstatic%>/icons/I.png">
                      <div class="inputE">
                        <input type="hidden" name="atom_<%= c.id %>" class="atom" value="<%= c.atomId %>" />
                        <% if (c.atomId != 0) { %>
                          <img src="<%=dynamic%>/images/<%=c.atom.getFileName()%>" />
                          <span><%=c.atom.name%>.<%=c.atom.extention%></span>
                        <% } else { %>
                          <span>- none -</span>
                        <% } %>
                      </div>
                      <div class="actions">
                        <button class="doEditorI"><%= __('Edit')%></button>
                        <button class="doDeletor"><%= __('Delete')%></button>
                        <span class="label label-info"><%= __('Move')%></span>
                      </div>

                    <% } else { %>
                      <img src="<%=cstatic%>/icons/C.png">
                      <div class="input">
                        <input type="hidden" name="atom_<%= c.id %>" class="atom" value="<%= c.atomId %>" />
                        <h5><%= c.name %></h5>
                        <textarea name="data_<%= c.id %>" class="stringdata"><%= c.data %></textarea>
                      </div>
                      <div class="actions">
                        <button class="doDeletor"><%= __('Delete')%></button>
                        <span class="label label-info"><%= __('Move')%></span>
                      </div>

                    <% } %>
                  </article>
                        <% } %>
                <% if ((prev === "X") || (prev === "Y")) { %>
                  <h4 class="main"><%= __('Main')%></h4>
                <% } %>

                </div>

                <div id="contentButtons">
                    <button id="doAddContent"><%= __('Add Content')%></button>
                        <% if ((login.level >= 99) && (page.link != 'global')) { %>
                        <button id="doAdjust"><%= __('Adjust')%></button>
                        <% } %>
                </div>

            </div>

            <!-- ----- -->
            <div id="seo">
            <!-- ----- -->
                <div>
                    <label for="link"><%= __('Link')%></label>
                    <span>/<%=page.language%>/</span> <input name="link" id="link" type="text" value="<%= page.link %>" size="25" />
                    <span>(/<%= page.language %>/<%= page.item.id %>)</span>
                </div>
                <div>
                    <label for="keywords"><%= __('Keywords')%></label>
                    <textarea name="keywords" id="keywords" rows="2"><%= page.keywords %></textarea>
                </div>
                <div>
                    <label for="description"><%= __('Description')%></label>
                    <textarea name="description" id="description" rows="4"><%= page.description %></textarea>
                </div>
            </div>

            <!-- -------- -->
            <div id="options">
            <!-- -------- -->
                <div>
                    <label for="active"><%= __('Active')%></label>
                    <input name="active" id="active" type="checkbox" value="Y" <%= checked(page.isActive()) %> />
                    <% if (login.level >= 50) { %>
                    <label for="needslogin"><%= __('Needs login')%></label>
                    <input name="needslogin" id="needslogin" type="checkbox" value="Y" <%= checked(page.item.needsLogin()) %> />
                    <% } else { %>
                    <input type="hidden" name="needslogin" id="needslogin" value="<%=page.item.needslogin%>">
                    <% } %>
                </div>
                <div>
                    <label for="dated"><%= __('Date')%></label>
                    <input name="dated" id="dated" type="text" value="<%= formatDate(page.item.dated) %>" class="dater"/>
                </div>
                <div>
                    <label for="validfrom"><%= __('Valid from')%></label>
                    <input name="validfrom" id="validfrom" type="text" value="<%= formatDate(page.item.validfrom) %>"  class="dater"/>
                    <label for="validto"> <%= __('to')%> </label>
                    <input name="validto" id="validto" type="text" value="<%= formatDate(page.item.validto) %>"  class="dater"/>
                </div>

                <% if (login && (login.level >= 99)) { %>
                <div>
                    <label for="template"><%= __('Template')%></label>
                    <select name="template" id="template">
                      <%- optionList(app.templates, page.item.templateId, "id", "name") %>
                    </select>
                </div>
                <% } else { %>
                <input type="hidden" name="template" id="template" value="<%=page.item.templateId%>">
                <% } %>

                <div>
                    <label for="orderby"><%= __('Order sublevels')%></label>
                    <select name="orderby" id="orderby">
                        <%- optionList(cody.Item.orderbyList, page.item.orderby) %>
                    </select>

                    <% if (login && (login.level >= 99)) { %>
                    <label for="showcontent">Show</label>
                    <select name="showcontent" id="showcontent">
                        <%- optionList(cody.Item.showcontentList, page.item.showcontent) %>
                    </select>
                    <% } else { %>
                    <input name="showcontent" id="showcontent" type="hidden" value="<%=page.item.showcontent%>" />
                    <% } %>
                </div>

                <% if (login.level >= 50) { %>
                <div>
                    <label for="alloweddomains"><%= __('Allowed Domains')%></label>
                    <input name="alloweddomains" id="alloweddomains" type="text" value="<%= page.item.alloweddomains %>" class="long" />
                    <select name="domains" id="domains">
                        <option value=""><%= __('add a group')%></option>
                        <%- optionList(app.domains, '') %>
                    </select>
                </div>
                <% } else { %>
                <input name="alloweddomains" id="alloweddomains" type="hidden" value="<%=page.item.alloweddomains%>" />
                <% } %>
            </div>
        </div>
	
		<div id="action_buttons">
			<button id="doSave"><%= __('Save')%></button>
			
			<% if (! page.isActive()) { %>
            <button id="doDelete"><%= __('Delete')%></button>
			<% } %>
							
			<span id="last_modif"><%= __('Last Modified')%>: <%= formatDate(page.updated) %></span>
	    </div>
	  
    </form>
</div>	

